package com.ayq.activiti.manager.enums;


/**
 *
 * <p>流程步骤枚举</p>
 * @Author ayq
 * @Date 2021/4/15 16:33
 */
public enum ActivitiManagerEnum {

    ERROR(-1,"步骤不匹配"),
    ONE(1,"one"),
    TWO(2,"two"),
    THREE(3,"three"),
    FOUR(4,"four"),
    FIVE(5,"five");


    private Integer number;

    private String key;

    ActivitiManagerEnum(Integer number, String key) {
        this.number = number;
        this.key = key;
    }

    public static ActivitiManagerEnum getResultEnum(int number) {
        for (ActivitiManagerEnum type : ActivitiManagerEnum.values()) {
            if (type.getNumber() == number) {
                return type;
            }
        }
        return ERROR;
    }

    public static ActivitiManagerEnum getResultEnum(String key) {
        for (ActivitiManagerEnum type : ActivitiManagerEnum.values()) {
            if (type.getKey().equals(key)) {
                return type;
            }
        }
        return ERROR;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }
}
